use salvo::prelude::*;
use serde::{Deserialize, Serialize};
use chrono::{NaiveDateTime, Utc};
// 单个部门信息 用于CRUD
#[derive(Serialize, Deserialize, Debug, ToSchema)]
pub struct SafeDepartment {
    pub id: i64,
    pub name: String,
    pub order_num: i32,
    pub department_id: String,
    pub parent_id: Option<i64>,
    pub tenant_id: Option<i64>,
    pub create_by: Option<String>,
    pub create_time: Option<NaiveDateTime>,
    pub update_by: Option<String>,
    pub update_time: Option<NaiveDateTime>,
}
// merge :https://docs.rs/merge2/latest/merge2/index.html
// 部门树结构 用于前端展示
#[derive(Serialize, Deserialize, Debug, ToSchema)]
pub struct DepartmentTree {
    pub id: i64,
    pub department_id: String,
    pub name: String,
    pub parent_id: Option<i64>,
    pub tenant_id: i64,
    pub create_by: String,
    pub create_time: NaiveDateTime,
    pub update_by: String,
    pub update_time: NaiveDateTime,
    pub children: Vec<DepartmentTree>,
}
